# 代码编写者： 李朔
# 开发时间： 2021/9/8 19:12
s='acbdadacacca'
def huiwen(s):
    l_p, r_p = 0, len(s) - 1
    while l_p <= r_p:
        if s[l_p] == s[r_p]:
            l_p += 1
            r_p -= 1
            continue
        else:
            return False
    return True
def validPalindrome(s):
    """
    :type s: str
    :rtype: bool
    """
    if huiwen(s):
        return True
    l_p, r_p = 0, len(s) - 1
    while l_p <= r_p:
        if s[l_p] == s[r_p]:
            l_p += 1
            r_p -= 1
        else:
            if huiwen(s[l_p:r_p]) or huiwen(s[l_p + 1:r_p + 1]):
                return True
            else:
                return False